<template>
    <view style="display: inherit; white-space: inherit">
        <block v-for="(item, index) in nodes" :key="index">
            <rich-text
                @tap="__e"
                class="_img"
                :data-attrs="item.attrs"
                :data-event-opts="[['tap', [['previewEvent', ['$event']]]]]"
                :id="item.attrs.id"
                :nodes="handler.setImgStyle(item, imgMode, imgLoad)"
                :style="'text-indent:0;' + handler.getStyle(item.attrs.style, 'inline-block')"
                v-if="item.name == 'img'"
            ></rich-text>

            <block v-else>
                <text :decode="true" v-if="item.type == 'text' && !item.decode">{{ item.text }}</text>
                <block v-else>
                    <rich-text :nodes="[item]" style="display: inline-block" v-if="item.type == 'text'"></rich-text>
                    <block v-else>
                        <text v-if="item.name == 'br'"></text>
                        <block v-else>
                            <view v-if="item.name == 'video'">
                                <view
                                    @tap="__e"
                                    :class="['_video ' + (item.attrs.class || '')]"
                                    :data-event-opts="[['tap', [['_loadVideo', ['$event']]]]]"
                                    :id="item.attrs.id"
                                    :style="item.attrs.style || ''"
                                    v-if="item.lazyLoad && !controls[item.attrs.id].play"
                                ></view>
                                <video
                                    :autoplay="item.attrs.autoplay || (controls[item.attrs.id] && controls[item.attrs.id].play)"
                                    @error="__e"
                                    @play="__e"
                                    :class="[item.attrs.class]"
                                    :controls="item.attrs.controls"
                                    :data-event-opts="[
                                        ['play', [['playEvent', ['$event']]]],
                                        ['error', [['videoError', ['$event']]]]
                                    ]"
                                    :data-source="item.attrs.source"
                                    :id="item.attrs.id"
                                    :loop="item.attrs.loop"
                                    :muted="item.attrs.muted"
                                    :poster="item.attrs.poster"
                                    :src="controls[item.attrs.id] ? item.attrs.source[controls[item.attrs.id].index] : item.attrs.src"
                                    :style="item.attrs.style || ''"
                                    :unitId="item.attrs['unit-id']"
                                    v-else
                                ></video>
                            </view>
                            <block v-else>
                                <audio
                                    :author="item.attrs.author"
                                    @error="__e"
                                    :class="[item.attrs.class]"
                                    :controls="item.attrs.controls"
                                    :data-event-opts="[['error', [['audioError', ['$event']]]]]"
                                    :data-source="item.attrs.source"
                                    :id="item.attrs.id"
                                    :loop="item.attrs.loop"
                                    :name="item.attrs.name"
                                    :poster="item.attrs.poster"
                                    :src="controls[item.attrs.id] ? item.attrs.source[controls[item.attrs.id].index] : item.attrs.src"
                                    :style="item.attrs.style || ''"
                                    v-if="item.name == 'audio'"
                                ></audio>
                                <block v-else>
                                    <view
                                        @tap="__e"
                                        :class="['_a ' + (item.attrs.class || '')]"
                                        :data-attrs="item.attrs"
                                        :data-event-opts="[['tap', [['tapEvent', ['$event']]]]]"
                                        hoverClass="navigator-hover"
                                        :hoverStartTime="25"
                                        :hoverStayTime="300"
                                        :style="item.attrs.style || ''"
                                        v-if="item.name == 'a'"
                                    >
                                        <trees @__l="__l" :imgMode="imgMode" :nodes="item.children" :vueId="'26db2430-1-' + index"></trees>
                                    </view>
                                    <block v-else>
                                        <ad
                                            @error="__e"
                                            :class="[item.attrs.class || '']"
                                            :data-event-opts="[['error', [['adError', ['$event']]]]]"
                                            :style="item.attrs.style || ''"
                                            :unitId="item.attrs['unit-id']"
                                            v-if="item.name == 'ad'"
                                        ></ad>
                                        <block v-else>
                                            <view :class="[(item.attrs.class || '') + ' _li']" :style="(item.attrs.style || '') + ';display:flex'" v-if="item.name == 'li'">
                                                <view class="_ol-before" v-if="item.type == 'ol'">{{ item.num }}</view>
                                                <view class="_ul-before" v-else>
                                                    <view class="_ul-type1" v-if="item.floor % 3 == 0">█</view>
                                                    <block v-else>
                                                        <view class="_ul-type2" v-if="item.floor % 3 == 2"></view>
                                                        <view class="_ul-type1" style="border-radius: 50%" v-else>█</view>
                                                    </block>
                                                </view>
                                                <trees
                                                    @__l="__l"
                                                    class="_node"
                                                    :imgMode="imgMode"
                                                    :loadVideo="loadVideo"
                                                    :nodes="item.children"
                                                    style="display: block"
                                                    :vueId="'26db2430-2-' + index"
                                                ></trees>
                                            </view>
                                            <block v-else>
                                                <rich-text
                                                    :class="['__' + item.name]"
                                                    :id="item.attrs.id"
                                                    :nodes="handler.setStyle(item)"
                                                    :style="'' + handler.getStyle(item.attrs.style, 'block')"
                                                    v-if="!(item.c || handler.isInlineTag(item.name) || item.continue)"
                                                ></rich-text>
                                                <trees
                                                    @__l="__l"
                                                    :class="[item.attrs.id + ' _' + item.name + ' ' + (item.attrs.class || '')]"
                                                    :imgMode="imgMode"
                                                    :loadVideo="loadVideo"
                                                    :nodes="item.children"
                                                    :style="item.attrs.style || ''"
                                                    :vueId="'26db2430-3-' + index"
                                                    v-else
                                                ></trees>
                                            </block>
                                        </block>
                                    </block>
                                </block>
                            </block>
                        </block>
                    </block>
                </block>
            </block>
        </block>
    </view>
</template>
<script module="handler" lang="wxs" src="@/components/jyf-Parser/handler.wxs"></script>
<script>
import trees from '@/components/jyf-Parser/trees';
import tabBar from '@/components/TabBar/tabBar';
(global.webpackJsonp = global.webpackJsonp || []).push([
    ['components/jyf-Parser/trees'],
    {
        6097: function (t, e, r) {
            'use strict';

            r.r(e);
            var o = r('ed47');
            var n = r.n(o);
            for (var i in o) {
                if (['default'].indexOf(i) < 0) {
                    (function (t) {
                        r.d(e, t, function () {
                            return o[t];
                        });
                    })(i);
                }
            }
            e.default = n.a;
        },
        6943: function (t, e, r) {
            'use strict';

            r.r(e);
            var o = r('b432');
            var n = r('6097');
            for (var i in n) {
                if (['default'].indexOf(i) < 0) {
                    (function (t) {
                        r.d(e, t, function () {
                            return n[t];
                        });
                    })(i);
                }
            }
            r('6c79');
            var s = r('f0c5');
            var a = r('bcdf');
            var c = Object(s.a)(n.default, o.b, o.c, false, null, null, null, false, o.a, void 0);
            if ('function' == typeof a.a) {
                Object(a.a)(c);
            }
            e.default = c.exports;
        },
        '6c79': function (t, e, r) {
            'use strict';

            var o = r('87eb');
            r.n(o).a;
        },
        '87eb': function (t, e, r) {},
        b432: function (t, e, r) {
            'use strict';

            r.d(e, 'b', function () {
                return o;
            });
            r.d(e, 'c', function () {
                return n;
            });
            r.d(e, 'a', function () {});
            var o = function () {
                this.$createElement;
                this._self._c;
            };
            var n = [];
        },
        bcdf: function (t, e, r) {
            'use strict';

            e.a = function (t) {
                t.options.wxsCallMethods || (t.options.wxsCallMethods = []);
            };
        },
        ed47: function (t, e, r) {
            'use strict';

            (function (t) {
                Object.defineProperty(e, '__esModule', {
                    value: true
                });
                e.default = void 0;
                var o = {
                    components: {
                        trees: function () {
                            Promise.resolve()
                                .then(
                                    function () {
                                        return resolve(r('6943'));
                                    }.bind(null, r)
                                )
                                .catch(r.oe);
                        }
                    },
                    name: 'trees',
                    data: function () {
                        return {
                            controls: {},
                            imgLoad: false
                        };
                    },
                    props: {
                        nodes: {
                            type: Array,
                            default: []
                        },
                        imgMode: {
                            type: String,
                            default: 'default'
                        }
                    },
                    mounted: function () {
                        for (this._top = this.$parent; 'parser' != this._top.$options.name; ) {
                            if (this._top._top) {
                                this._top = this._top._top;
                                break;
                            }
                            this._top = this._top.$parent;
                        }
                    },
                    beforeDestroy: function () {
                        if (this._observer) {
                            this._observer.disconnect();
                        }
                    },
                    methods: {
                        playEvent: function (t) {
                            if ((this._top.videoContexts || []).length > 1 && this._top.autopause) {
                                for (var e = this._top.videoContexts.length; e--; ) {
                                    if (this._top.videoContexts[e].id != t.currentTarget.id) {
                                        this._top.videoContexts[e].pause();
                                    }
                                }
                            }
                        },
                        previewEvent: function (e) {
                            var r = e.currentTarget.dataset.attrs;
                            if (!r.ignore) {
                                var o = true;
                                this._top.$emit('imgtap', {
                                    id: e.currentTarget.id,
                                    src: r.src,
                                    ignore: function () {
                                        return (o = false);
                                    }
                                });
                                if (o && this._top.autopreview) {
                                    var n = this._top.imgList || [];
                                    if (n[r.i]) {
                                        var i = parseInt(r.i);
                                    } else {
                                        var i = ((n = [r.src]), 0);
                                    }
                                    t.previewImage({
                                        current: i,
                                        urls: n
                                    });
                                }
                            }
                        },
                        tapEvent: function (e) {
                            var r = true;
                            var o = e.currentTarget.dataset.attrs;
                            o.ignore = function () {
                                return (r = false);
                            };
                            this._top.$emit('linkpress', o);
                            if (r) {
                                if (o['app-id'] || o.appId) {
                                    return t.navigateToMiniProgram({
                                        appId: o['app-id'] || o.appId,
                                        path: o.path || ''
                                    });
                                }
                                if (o.href) {
                                    if ('#' == o.href[0]) {
                                        if (this._top.useAnchor) {
                                            this._top.navigateTo({
                                                id: o.href.substring(1)
                                            });
                                        }
                                    } else {
                                        0 == o.href.indexOf('http') || 0 == o.href.indexOf('//')
                                            ? this._top.autocopy &&
                                              t.setClipboardData({
                                                  data: o.href,
                                                  success: function () {
                                                      t.showToast({
                                                          title: '链接已复制'
                                                      });
                                                  }
                                              })
                                            : t.navigateTo({
                                                  url: o.href
                                              });
                                    }
                                }
                            }
                        },
                        triggerError: function (t, e, r, o, n) {
                            this._top.$emit('error', {
                                source: t,
                                target: e,
                                errMsg: r,
                                errCode: o,
                                context: n
                            });
                        },
                        loadSource: function (t) {
                            return !(
                                t.dataset.source.length <= 1 ||
                                (this.controls[t.id]
                                    ? !(this.controls[t.id] && this.controls[t.id].index < t.dataset.source.length) ||
                                      (this.$set(this.controls[t.id], 'index', this.controls[t.id].index + 1), 0)
                                    : (this.$set(this.controls, t.id, {
                                          index: 1
                                      }),
                                      0))
                            );
                        },
                        adError: function (t) {
                            this.triggerError('ad', t.currentTarget, '', t.detail.errorCode);
                        },
                        videoError: function (e) {
                            if (!this.loadSource(e.currentTarget) && this._top) {
                                this.triggerError('video', e.currentTarget, e.detail.errMsg, void 0, t.createVideoContext(e.currentTarget.id, this));
                            }
                        },
                        audioError: function (t) {
                            this.loadSource(t.currentTarget) || this.triggerError('audio', t.currentTarget, t.detail.errMsg);
                        },
                        _loadVideo: function (t) {
                            this.$set(this.controls, t.currentTarget.id, {
                                play: true,
                                index: 0
                            });
                        }
                    }
                };
                e.default = o;
            }.call(this, r('543d').default));
        }
    }
]);
(global.webpackJsonp = global.webpackJsonp || []).push([
    'components/jyf-Parser/trees-create-component',
    {
        'components/jyf-Parser/trees-create-component': function (t, e, r) {
            r('543d').createComponent(r('6943'));
        }
    },
    [['components/jyf-Parser/trees-create-component']]
]);
</script>
<style>
@import './trees.css';
</style>
